﻿
Public MustInherit Class _to_uint32(Of keyT)
    Inherits _template_parameter(Of keyT, UInt32)
    Public MustOverride Function reverse(ByVal i As UInt32) As keyT
End Class

Public Class _byte_to_uint32
    Inherits _to_uint32(Of Byte)

    Public Overrides Function reverse(ByVal r As UInt32) As Byte
        Dim rtn As Byte = 0
        convertor.tobyte(r, rtn)
        Return rtn
    End Function

    Protected Overrides Function at(ByVal k As Byte) As UInt32
        Return k
    End Function
End Class

Public Class _char_to_uint32
    Inherits _to_uint32(Of Char)

    Public Overrides Function reverse(ByVal i As UInt32) As Char
        Return convertor.tochar(i)
    End Function

    Protected Overrides Function at(ByVal k As Char) As UInt32
        Return Convert.ToUInt32(k)
    End Function
End Class

Public Class _string_to_uint32
    Inherits _to_uint32(Of String)

    Protected Overrides Function at(ByVal k As String) As UInt32
        Return signing(k)
    End Function

    Public Overrides Function reverse(ByVal i As UInt32) As String
        assert(False)
        Return Nothing
    End Function
End Class